﻿#region MIT Licence
/*
 * Copyright (C) 2014 PdfCreative
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 * and associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom 
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included 
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Text;

using PdfCreative.Pdf.Writer;

namespace PdfCreative.Pdf.Graphics
{
    /// <summary>
    /// The IResourceWriter interface is used by graphical stock objects such as pens and brushes that require
    /// resources in a PDF document.
    /// Pattern brushes use pattern resources, and implement the IResourceWriter interface.
    /// Brushes and pens that have their RequiresResources property set to true must implement this interface.
    /// </summary>
    public interface IResourceWriter
    {
        /// <summary>
        /// True if this resource is a custom resource. False otherwise.
        /// </summary>
        bool IsCustomResource { get; }

        /// <summary>
        /// Returns the scope of this resource writer.
        /// </summary>
        ResourceScope Scope { get; }

        /// <summary>
        /// Writes the resource for this stock object.
        /// </summary>
        /// <param name="graphics">The graphics object to use as a context</param>
        /// <param name="writer">The writer to write to</param>
        /// <param name="resourceReference">The resource reference that has been assigned to this stock object.</param>
        /// <param name="scope">The scope of this resource instance.</param>
        void WriteResource(Graphics graphics, PdfWriter writer, PdfResourceReference resourceReference, ScopedResource scope);
    }
}
